<?php
/**
 * aheadWorks Co.
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the EULA
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://ecommerce.aheadworks.com/LICENSE-M1.txt
 *
 * @category   AW
 * @package    AW_Points
 * @copyright  Copyright (c) 2008-2011 aheadWorks Co. (http://www.aheadworks.com)
 * @license    http://ecommerce.aheadworks.com/LICENSE-M1.txt
 */
?>
<?php $_order = $this->getOrder() ?>
<h3><?php echo $this->__('Order #%s', $_order->getRealOrderId()) ?></h3>
<p><?php echo $this->__('Order Date: %s', $this->formatDate($_order->getCreatedAtStoreDate(), 'long')) ?></p>
<div class="divider"></div>
<div class="col2-set">
    <?php if (!$_order->getIsVirtual()): ?>
    <div class="col-1">
        <h4><?php echo $this->__('Shipping Address') ?></h4>
        <address><?php echo $_order->getShippingAddress()->format('html') ?></address>
    </div>
    <div class="col-2">
    <?php else: ?>
    <div class="col-1">
    <?php endif; ?>
        <h4><?php echo $this->__('Billing Address') ?></h4>
        <address><?php echo $_order->getBillingAddress()->format('html') ?></address>
    </div>
<?php if (!$_order->getIsVirtual()): ?>
</div>
<br />
<div class="col2-set">
    <div class="col-1">
        <h4><?php echo $this->__('Shipping Method') ?></h4>
         <?php echo $_order->getShippingDescription() ?>
    </div>
<?php endif; ?>
    <div class="col-2">
        <h4><?php echo $this->__('Payment Method') ?></h4>
        <?php echo $this->getPaymentInfoHtml() ?>
    </div>
</div>
<br />
<h4><?php echo $this->__('Items Ordered') ?></h4>
<table cellspacing="0" class="data-table print" id="my-orders-table">
    <col />
    <col width="25%" />
    <col width="1" />
    <col width="1" />
    <col width="1" />
    <thead>
        <tr>
            <th><?php echo $this->__('Product Name') ?></th>
            <th><?php echo $this->__('SKU') ?></th>
            <th class="a-right"><?php echo $this->__('Price') ?></th>
            <th class="a-center"><?php echo $this->__('Qty') ?></th>
            <th class="a-right last"><?php echo $this->__('Subtotal') ?></th>
        </tr>
    </thead>
    <?php $colspan = 4; ?>
    <tfoot>
        <tr>
            <td colspan="<?php echo $colspan; ?> " class="a-right"><?php echo $this->__('Order Subtotal') ?></td>
            <td class="last a-right"><?php echo $_order->formatPrice($_order->getSubtotal()) ?></td>
        </tr>
        <?php if ($_order->getDiscountAmount() > 0): ?>
        <tr>
            <td colspan="<?php echo $colspan; ?>" class="a-right"><?php echo $this->__('Discount :') ?></td>
            <td class="last a-right"><?php echo $_order->formatPrice(0.00 - $_order->getDiscountAmount()) ?></td>
        </tr>
        <?php endif; ?>
        <?php if ($_order->getTaxAmount() > 0): ?>
            <?php echo $this->getChildHtml('tax'); ?>
        <?php endif; ?>
        <?php if (!$_order->getIsVirtual() && ($_order->getShippingAmount()*1 || $_order->getShippingDescription())): ?>
        <tr>
            <td colspan="<?php echo $colspan; ?>" class="a-right"><?php echo $this->__('Shipping & Handling') ?></td>
            <td class="last a-right"><?php echo $_order->formatPrice($_order->getShippingAmount()) ?></td>
        </tr>
        <?php endif; ?>
        <?php if ($_order->getMoneyForPoints()): ?>
            <tr>
                <td colspan="<?php echo $colspan; ?>" class="a-right"><?php echo Mage::helper('points/config')->getPointUnitName() ?></td>
                <td class="last a-right"><?php echo $_order->formatPrice($_order->getMoneyForPoints()) ?></td>
            </tr>
        <?php endif; ?>
        <tr>
            <td colspan="<?php echo $colspan; ?>" class="a-right"><?php echo $this->__('Grand Total') ?></td>
            <td class="last a-right"><?php echo $_order->formatPrice($_order->getGrandTotal()) ?></td>
        </tr>
    </tfoot>
    <?php $_items = $_order->getItemsCollection(); ?>
    <?php $_count = $_items->count(); ?>
    <?php foreach ($_items as $_item): ?>
    <?php if ($_item->getParentItem()) continue; ?>
    <tbody>
        <?php echo $this->getItemHtml($_item) ?>
    </tbody>
        <?php endforeach; ?>
</table>
<script type="text/javascript">decorateTable('my-orders-table', {'tbody' : ['odd', 'even'], 'tbody tr' : ['first', 'last']})</script>
<script type="text/javascript">window.print();</script>